package org.zjt.demo.service.imp;

import org.springframework.remoting.RemoteAccessException;
import org.springframework.retry.annotation.Recover;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;

/**
 * DESC
 *
 * @author
 * @create 2017-05-16 下午6:25
 **/

@Service
public class RetryService {
    @Retryable(RemoteAccessException.class)
    public void service()throws Exception {
        System.out.println("---------------------service----------------------");
        throw new RemoteAccessException("2222");
    }


    @Recover
    public void recover(RemoteAccessException e) {
        System.out.println("---------------------recover----------------------"+e.getMessage());
    }
}